#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 20;
int a[N];
map<int, int> mp;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, l, r, x; cin >> n >> l >> r >> x;
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < (1 << n); i++) {
        int maxa = 0, mina = 1000010, sum = 0;
        mp.clear();
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) {
                mp[a[j]]++;
                sum += a[j];
                mina = min(mina, a[j]);
                maxa = max(maxa, a[j]);
            }
        }
        if (sum >= l && sum <= r && maxa - mina >= x && mp.size() >= 3) ans++;
    }
    cout << ans << endl;
    return 0;
}